import React, { useState, useEffect, } from 'react'
import Flushed from '../../Monitoring_analytics/Operate_monitor/Component/Flushed';
import User_Title from './Component/user_Title'
import User_Content from './Component/user_content'

import { getqianuser } from '../../../request/api'





export default function After_sales_management() {
  useEffect(() => {
    allgetafter()
  }, [])




  // 获取全部的用户信息
  let [afterdata, setdata] = useState([])
  const allgetafter: any = async () => {
    const data: any = await getqianuser({})
    console.log(data);
    setdata(data.data)
  }

  // 获取子组件传递的搜索完后的数据信息，更新用户信息
  const getTitle = (item: any) => {
    console.log(item);
    setdata(item)
  }

  // 接收列表子组件传递的修改状态的数据id
  const [list_id, setlist_id] = useState<any>([])
  const getid = (id: any) => {
    setlist_id(id)
  }
  // 接收title组件更改完数据之后，重新获取全部数据
  const getall = (item) => {
    console.log(item);
    if (item == 200) {
      allgetafter()
    }
  }


  return (
    <div>
      <User_Title name='订单管理' getTitle={getTitle} list_id={list_id} getall={getall} ></User_Title>
      <Flushed></Flushed>
      <div style={{ width: '100%', backgroundColor: 'white', padding: '0.5rem', marginTop: '0.5rem' }}>
        <User_Content afterdata={afterdata} getid={getid} getall={getall}></User_Content>
      </div>
    </div>
  )
}
